<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<?php include(DDROOTPATH.'/cache/title/'.$pagetag.'_title.php');?>
<link href="template/<?=MOBAN?>/css/style.css" rel="stylesheet" type="text/css" />
<link href="template/<?=MOBAN?>/css/layout.css" rel="stylesheet" type="text/css" />
<link href="template/<?=MOBAN?>/css/comm.css" rel="stylesheet" type="text/css" />
<link href="template/<?=MOBAN?>/css/baobei.css" rel="stylesheet" type="text/css" />

<style>
   #ad12 table{ width:290px;}
   #ad12 table,tbody,tr,td{ border:none;}
   </style>
<script language="javascript" type="text/javascript" src="template/<?=MOBAN?>/js/jquery.js"></script>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/base64.js"></SCRIPT>
<SCRIPT type="text/javascript" src="template/<?=MOBAN?>/js/function.js"></SCRIPT>
<script>
$(document).ready(function(){
	 $('#form').submit(function(){
		var comment=$('#formComment').val();
		if(comment==''){
		    alert('评论内容不能为空');
			$('#formComment').focus();
		}
		else if($('#num').attr('class')=='remind'){
            alert('评论内容超出50个字');
			$('#formComment').focus();
		}
		else{
		    $.post("a.php",{fun:'save_comment',shai_id:<?=$id?>,xs:'<?=$info['xs']?>',comment:comment},function(data){//alert(data);
		        if(data==10 || data==11 || data==12 ){
				    alert(msg[data]);
				}
				else{
					if(data>0 && data<100)
					{
						alert("您评论的太频繁了！");
					}
					else
					{
					  $('#formComment').val('');
					  $('#num').text(50);
					  $('#hhnjknjmkd').prepend(data);
					  $('#hhnjknjmkd .msgitem').show('slow');
					  $('#expression').hide('slow');
					  $('#comment_num').text(parseInt($('#comment_num').text())+1);
					}
				}
		    });
		}
	    return false;
	});
});


function imgAuto(img, maxW, maxH) {
	var oriImg = document.createElement("img");
	oriImg.onload = function(){
		if (oriImg.width == 0 || oriImg.height == 0)
			return;
		var oriW$H = oriImg.width / oriImg.height;
		// var maxW$H = maxW / maxH;

		if (oriImg.height > maxH) {
			img.height = maxH;
			// img.removeAttribute("width");
			img.width = maxH * oriW$H;
		}
		if (img.width > maxW) {
			img.width = maxW;
			// img.removeAttribute("height");
			img.height = maxW / oriW$H;
		}

		if (maxH) {// if it defined the maxH argument
			if (img.height > 0)
				img.style.marginTop = (maxH - img.height) / 2 + "px";
		}
	};
	oriImg.src = img.src;
}

expressionShouldShow=0;

msg=new Array();
msg[6]='您已经送过红心';
msg[7]='登陆才能送红心哦';
msg[10]='两次评论间隔10秒';
msg[11]='您的等级不足，不能评论';
msg[12]='评论不能为空或者含有敏感词';

function addExpression(myField, myValue)
{
	var h=$("#"+myField).val();
	h+=myValue;
	$("#"+myField).val(h);/*
    myField = document.getElementById(myField);
    //IE
    if (document.selection)
    {
        myField.focus();
        sel = document.selection.createRange();
        myValue = myValue;
        sel.text = myValue;
        sel.select();
    }
    //MOZILLA
    else if (myField.selectionStart || myField.selectionStart == '0')
    {
        var startPos = myField.selectionStart;
        var endPos = myField.selectionEnd;
        // save scrollTop before insert
        var restoreTop = myField.scrollTop;
        myValue = expression[myValue];
        myField.value = myField.value.substring(0, startPos) + myValue + myField.value.substring(endPos,myField.value.length);
        if (restoreTop > 0)
        {
            // restore previous scrollTop
            myField.scrollTop = restoreTop;
        }
        myField.focus();
        myField.selectionStart = startPos + myValue.length;
        myField.selectionEnd = startPos + myValue.length;
    }
    else
    {
        myField.value += myValue;
        myField.focus();
    }
	*/
}

function openShare(name){
	var url=window.location.href;
	if(name=='sina'){
	    var url='http://v.t.sina.com.cn/share/share.php?&title=<?=urlencode($info['title'])?>&url='+url+'&source=anzhong&retcode=0';
	}
	if(name=='renren'){
	    var url='http://share.renren.com/share/buttonshare.do?link='+url+'&title=<?=urlencode($info['title'])?>';
	}
	if(name=='tx'){
	    var url='http://v.t.qq.com/share/share.php?title=<?=urlencode($info['title'])?>&url='+url;
	}
    window.open(url,name,"top=100,left=400,width=610,height=570,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}

function mouseLocation(e){
	rightX=(document.body.offsetWidth-950)/2;
    if(e.pageX<rightX || e.pageX>rightX+700 || e.pageY<640 || e.pageY>765){
	    $('#expression').fadeOut('slow');
	}
}

$.ajaxSetup ({
    cache: false //关闭AJAX相应的缓存
});
$(function(){;
	//$('body').click(mouseLocation);
	$('#formComment').bind('focus keyup input paste',function(){  //采用几个事件来触发（已增加鼠标粘贴事件）   
	    $('#num').text(50-$(this).attr("value").length);  //获取评论框字符长度并添加到ID="num"元素上
		if((50-$(this).attr("value").length)<0){
			$('#num').addClass('remind');
        }
		else{
		    $('#num').removeClass('remind');
		}
	});
	
	$('#like').click(function(){
	    var hart=parseInt($('#hart_num').text());
		var user_hart=parseInt($('#user_hart').text());
		$.post("a.php",{fun:'inc_hart',shai_id:<?=$id?>,xs:'<?=$info['xs']?>'},function(data){//alert(data);
			var data= eval("(" + data + ")");
			if(data.err==0){
				$('#hart_num').text(hart+1);
				$('#user_hart').text(user_hart+1);
			}
			else{
			    alert(msg[data.msg]);
			}
		});
	});
	var ssdsd=$("#pro_phos").attr("src");
	if(ssdsd==""){alert("没有了");history.back();}
	var godrt=$(".good").height()+15;
	$(".good-right").css("height",godrt+"px");
});
function tiaozhuan(n){
	id=<?=$id?>;
	if(n==0){id-=1;window.location.href="baobei.php?id="+id;};
	if(n==1){id+=1;window.location.href="baobei.php?id="+id;};
};

</script>
</head>
<body>
<?php
$modtag="bblist";
include("head_shop.tpl.php");
?>
<div id="Content" class="clearfix MarginT10" style="height:170px">
  <dl class="sharelist">
    <dt class="clearfix">
      <ul>
        <li><a <?php if($catid==''){?> class="active"<?php }?> href="userbao<?=$url_head_id?><?=$userid?>">全部分享</a></li>
        <?php foreach($shaicat_arr as $k=>$v){?>
        <li><a <?php if($k==$catid){?> class="active"<?php }?> href="userbao<?=$url_head_id?><?=$userid?><?=WJT?'-':'&catid='?><?=$k?><?=$url_head_xs?><?=$xs?><?=$url_head_page?>1<?=$url_end?>"><?=$v?></a></li>
        <?php }?>
      </ul>
    </dt>
    <dd>
      <ul>
      <!--<li><a href="#" class="active">最新宝贝</a></li>
      <li><a href="#" class="MarginR0">最热宝贝</a></li>-->
      </ul>
    </dd>
 </dl>
  <div class="clears"></div>
  <dl class="sharebox clearfix">
    <dt>
      <ul class="shareshop clearfix">
        <li><img src="upload/avatar/<?=get_avatar_filepath($info['dduserid'], $size = 'middle')?>" width="119" height="119" /></li>
        <li class="MarginL10 MarginT10"><div><h3 class="username FLeft"><?=$info['ddusername']?></h3><span class="FLeft">晒单：<strong class="Colorfh Font16"><?=$shai_nums?></strong></span><span class="MarginL10 FLeft">分享：<strong class="Colorfh Font16"><?=$share_nums?></strong></span></div>
        <Div class="clears"></Div>
        <div class="FLeft">
        <a <?php if($xs=='all'){echo "class=\"hisbaby\"";}else{echo "class=\"hisbaby like\"";} ?> href="userbao<?=$url_head_id?><?=$info['dduserid']?><?=WJT?'-':'&catid='?><?=$catid?><?=$url_head_xs?>all<?=$url_head_page?>1<?=$url_end?>">TA的宝贝</a>
        <a <?php if($xs=='like'){echo "class=\"hisbaby\"";}else{echo "class=\"hisbaby like\"";}?> href="userbao<?=$url_head_id?><?=$info['dduserid']?><?=WJT?'-':'&catid='?><?=$catid?><?=$url_head_xs?>like<?=$url_head_page?>1<?=$url_end?>">TA的喜欢</a></div>
        </li>
      </ul>
    <div class="clears"></div>
    </dt>
    <dd class="receive">
      <ul>
        <li><?=$info['hart']?></li>
        <li class="recB"> 收到的</li>
      </ul>
    </dd>
  </dl>
</div>
<!--内容+猜你喜欢的--> 
<div class="bbinfo">
  <div class="left">
   <div class="line" style="overflow:hidden"><font style="font-size:20px;color:#333333"><b><?=$info['title']?></b></font></div>
   <div class="line">
      <div class="t">价格：<font style="color:#F00;font-size:16px"><b><?=$info['price']?></b></font>元</div>
      <div class="t" style="margin-left:50px">返米：<font style="color:#F00;font-size:16px"><b><?=floor($info['fxje']*100)?></b></font>米</div>
      <div class="t" style="float:right;margin-right:10px;display:inline"><a target="_blank" href="<?=$gotoitem?>"><img src="template/<?=MOBAN?>/images/gobuy.gif" width="116" height="37" border="0" /></a></div>
   </div>
   <div class="line" style="height:331px">
   	<div class="picbox"><?=html_img($info['image'],$info['title'],'','','')?></div>
   </div>
   <div class="line">
      <div class="box" id="like" style="background:url(template/<?=MOBAN?>/images/like.gif) left;cursor:pointer;width:63px" title="送红心" ></div>
      <div class="box" style="background:#000;width:30px;line-height:29px;text-align:center;color:#FFF" id="hart_num"><?=$info['hart']?></div>
      <div class="box" style="float:right;margin-right:20px;display:inline">
      	<div class="txt"><img src="template/<?=MOBAN?>/images/ico_fx.gif" width="18" height="18" border="0" /></div>
        <div class="txt"> 分享给好友：</div>
        <div class="txt">
          <!-- Baidu Button BEGIN -->
          <div id="bdshare" class="bdshare_t bds_tools get-codes-bdshare" style="margin-top:0px">
              <a class="bds_qzone"></a>
              <a class="bds_tsina"></a>
              <a class="bds_tqq"></a>
              <a class="bds_renren"></a>
              <a class="shareCount"></a>
          </div>
          <script type="text/javascript" id="bdshare_js" data="type=tools" ></script>
          <script type="text/javascript" id="bdshell_js"></script>
          <script type="text/javascript">
              document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + new Date().getHours();
          </script>
          <!-- Baidu Button END --> 
        </div>
      </div> 
   </div>  
   <div class="line" style="height:10px;border-top:#bfbfbf solid 3px"></div>
   <div class="line" style="height:50px">
     <div class="msgitem" style="border:0">
     	<div class="headfm"><img onerror="this.src='images/noavatar_middle.gif'" src="upload/avatar/<?=get_avatar_filepath($info['dduserid'], $size = 'small', $type = '')?>" width="40" height="40" /></div>
        <div class="ltxt"><font style="font-size:12px;color:#bf0000"><?=$info['ddusername']?></font>  <font style="color:#57504f"></font><?=date('m月d日 H:s',$info['time'])?></div>
        <div class="ltxt" style="margin-top:2px"><?=$info['comment']?></div>
     </div>
   </div>
   <div class="line" style="height:116px">
   	 <div class="jt"></div>
     <div class="plfm">
     	<form id="form">
     	<div class="memofm"><textarea id="formComment" class="memo"  ></textarea></div>
        <div class="send"><input type="submit" class="ssubmit" value="评论" id="formSubmit" <?php if($_SESSION['dduserid']<$shai_set['limit_level']){?>  title="等级不足，不能评论" disabled="disabled"<?php }?> /></div>
        </form>
        <div class="top"><a id="addExpression" onclick="$('#expression').fadeIn();" href="javascript:void();" ><img  src="template/<?=MOBAN?>/images/bq1.gif" width="72" height="16" border="0" /></a></div>
        <div class="top" style="float:right;margin-right:110px;display:inline">还可以输入<span id="num">50</span>个字</div>
       <div id="expression">
        <ul>
          <?php foreach($expression as $k=>$v){?>
          <li><img src="<?=$navheadurl?>images/emoticons/<?=$k?>.gif" style="cursor:pointer" onclick="addExpression('formComment','{<?=$v?>}');"/></li>
          <?php }?>
        </ul>
        <div style="float:left;margin-left:0px;cursor:pointer;width:33px;height:18px;background:url(template/<?=MOBAN?>/images/bqclose.gif) left" onclick="$('#expression').fadeOut('slow');"></div>
       </div>
     </div> 
   </div>
           <script type="text/javascript">
        $(document).ready(function(){
			var h=$("#hhnjknjmkd").height();
			if(h>400){$("#hhnjknjmkd").css("height","400px");}
		});
        </script>
  <div class="line" id="hhnjknjmkd" style="height:auto;overflow:hidden">
   <?php foreach($comment_arr as $row){?>
   <div class="msgitem" style="margin-top:10px">
      <div class="headfm"><a href="userbao.php?id=<?=$row['dduserid']?>"><img onerror="this.src='images/noavatar_middle.gif'" src="upload/avatar/<?=get_avatar_filepath($info['dduserid'], $size = 'small', $type = '')?>" width="40" height="40" /></a></div>
      <div class="ltxt"><font style="font-size:12px;color:#bf0000"><?=$row['ddusername']?></font>  <font style="color:#57504f"></font><?=date('m月d日 H:i',$row['time'])?></div>
      <div class="ltxt" style="margin-top:2px"><?=$row['comment']?></div>
   </div>  
   <?php }?> 
   <div class="megas512" style="text-align:right;float:right;width:500px"><?php pageft($comment_nums,$pagesize,1,0,0,10,$page_baobei);echo $pagenav;?></div>
  </div>
 </div> 
 
  <div class="right">
   	<div class="title"><b>猜您喜欢的其他宝贝</b></div>
    <?php $n=0; foreach($orther_baobei as $arr){$n++;?>
    	<div class="picbox"><a href="baobei<?=$url_head_id?><?=$arr['id']?><?=$url_end?>"><?=html_img($arr['image'],$arr['title'],'goods_a_img','181','181')?></a></div>
     <?php }?>
  </div>
</div>

<div class="lineclear" style="margin-top:20px"></div>
<?php 
	include ("footer.tpl.php");
?>
</body>
</html>
